/*
 * @Descripttion: 
 * @version: 
 * @Author: 高月飞
 * @Date: 2023-11-24 21:36:39
 * @LastEditors: 高月飞
 * @LastEditTime: 2023-11-25 19:18:18
 */
/*
 * @Descripttion: 
 * @version: 
 * @Author: 高月飞
 * @Date: 2023-11-20 19:28:09
 * @LastEditors: 高月飞
 * @LastEditTime: 2023-11-24 16:52:17
 */

import type { ICustomerData } from "@/types/customer";
import { post, get, put, del } from "@/utils/NetworkRequest/index";
import { objToQueryString } from '@/utils/Tools/ObjectToCharacter';

//客户添加
export const customerAddApi = (customerAddData: ICustomerData.ICustomer) => {
    return post<ICustomerData.ICustomer>('/api/customer/new', customerAddData)
}
//全部客户列表
export const userCustomerAllApi = (page = 1, query = {}, size = 10) => {
    if ('page' in query) {
        delete query.page
    }
    if ('pageSize' in query) {
        delete query.pageSize
    }
    query = objToQueryString(query)
    return get<ICustomerData.ICustomerListData>(`/api/customer/all?page=${page}&pageSize=${size}${query}`)

}
//导入数据
export const importUsersApi = (importCustomerData: ICustomerData.ICustomer) => {
    return post<ICustomerData.ICustomer>('/api/customer/import', importCustomerData)
}
//我的客户
export const userCustomerMineApi = (page = 1, query = {}, size = 10) => {
    if ('page' in query) {
        delete query.page
    }
    if ('pageSize' in query) {
        delete query.pageSize
    }
    query = objToQueryString(query)
    return get<ICustomerData.ICustomerListData>(`/api/customer/mine?page=${page}&pageSize=${size}${query}`)

}
//公海客户
export const userCustomerSeaApi = (page = 1, query = {}, size = 10) => {
    if ('page' in query) {
        delete query.page
    }
    if ('pageSize' in query) {
        delete query.pageSize
    }
    query = objToQueryString(query)
    return get<ICustomerData.ICustomerListData>(`/api/customer/sea?page=${page}&pageSize=${size}${query}`)

}
//下属客户
export const userCustomerSubordinateApi = (page = 1, query = {}, size = 10) => {
    if ('page' in query) {
        delete query.page
    }
    if ('pageSize' in query) {
        delete query.pageSize
    }
    query = objToQueryString(query)
    return get<ICustomerData.ICustomerListData>(`/api/customer/subordinate?page=${page}&pageSize=${size}${query}`)

}
//跟进id客户
export const userCustomerFollowIDUpApi = (id: number) => {
    return get<any>(`/api/customer/mine/:${id}`)
}
// 跟进成功

export const userCustomerFollowUpApi = (followUpData: any) => {
    return post<any>(`/api/customer/mine/followup`, followUpData)
}

// 编辑

export const userCustomerEditApi = (editData: any) => {
    return post<any>(`/api/customer/mine/edit`, editData)
}
// 跟进信息

export const userCustomerfollowMessageApi = (messageid: number) => {
    return get<any>(`/api/customer/mine/followmessage/:${messageid}`)
}
// 跟进信息

export const userCustomerContractinMessageApi = (messageid: number) => {
    return get<any>(`/api/customer/mine/contractinmessage/:${messageid}`)
}

// 回款计划

export const userCustomerPayMessageApi = (messageid: number) => {
    return get<any>(`/api/customer/mine/paymessage/:${messageid}`)
}
// 归属记录

export const userCustomervestMessageApi = (messageid: number) => {
    return get<any>(`/api/customer/mine/vestmessage/:${messageid}`)
}
// 附件信息

export const userCustomerattaMessageApi = (messageid: number) => {
    return get<any>(`/api/customer/mine/attatmessage/:${messageid}`)
}
// 操作日志

export const userCustomerlogMessageApi = (messageid: number) => {
    return get<any>(`/api/customer/mine/logmessage/:${messageid}`)
}
// 回款新增

export const userCustomerendApi = (endData: any) => {
    return post<any>(`/api/customer/mine/end`, endData)
}

//删除数据
export const userCustomerDelApi = (delid: number) => {
    return post<any>(`/api/customer/mine/del`, delid)
}